<script setup lang='ts'>
defineOptions({ name: 'AppSportsLoading' })

const { logoAndIcoAndLoading } = storeToRefs(useAppStore())

const textArr = [
  { str: $t('spt_loading_str1'), delay: '0s' },
  { str: $t('spt_loading_str2'), delay: '4s' },
  { str: $t('spt_loading_str3'), delay: '8s' },
  { str: $t('spt_loading_str4'), delay: '12s' },
  { str: $t('spt_loading_str5'), delay: '16s' },
]
</script>

<template>
  <div class="app-sports-loading" @scroll.stop @touchmove.stop.prevent>
    <div class="w-[200px]">
      <BaseImage :url="'/' + logoAndIcoAndLoading.logo_white" isCloud />
    </div>
    <div class="my-[25px]">
      <BaseLoading style="--tg-base-loading-size:53px;" />
    </div>
    <div class="text-wrap">
      <span class="text" v-for="s, i in textArr" :key="i" :style="{ animationDelay: s.delay }">
        {{ s.str }}
        <span class="dot" style="animation-delay: 0.1s;">.</span>
        <span class="dot" style="animation-delay: 0.2s;">.</span>
        <span class="dot" style="animation-delay: 0.3s;">.</span>
      </span>
    </div>
  </div>
</template>

<style lang='scss' scoped>
.app-sports-loading {
  width: 100%;
  height: calc(100vh - var(--footer));
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  background: var(--color-bg-black-2);
  position: absolute;
  z-index: 102;
}

.text-wrap {
  color: var(--color-text-white-0);
  display: flex;
  opacity: 0.7;
  font-size: 18px;
  text-align: center;
  line-height: 28px;
  letter-spacing: 0.4px;
  justify-content: center;
}

.text {

  width: 100%;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  animation: bt38144 20s linear infinite;
}

.dot {
  animation: bt38145 1.5s linear infinite;
  font-size: 26px;
  animation-fill-mode: both;
}

@keyframes bt38145 {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 0.7;
  }

  100% {
    opacity: 0;
  }
}

@keyframes bt38144 {
  0% {
    opacity: 0;
  }

  2% {
    opacity: 0;
  }

  5% {
    opacity: 0.7;
  }

  17% {
    opacity: 0.7;
  }

  20% {
    opacity: 0;
  }

  80% {
    opacity: 0;
  }

  100% {
    opacity: 0;
  }
}
</style>
